package com.zbf1811a.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/7/27  17:10
 * 描述:
 */
@Configuration
public class MQ11AConfig {


    @Bean("queue1")
    public Queue getQueue(){
        return new Queue("REDIS-QUEUE",true,false,false);
    }


    @Bean("exchange1")
    public Exchange getExchange(){
        return ExchangeBuilder.directExchange("REDIS-EXCHANGE").durable(true).build();
    }


    @Bean("binding1")
    public Binding getBinding(@Qualifier("queue1") Queue queue,@Qualifier("exchange1") Exchange exchange){
        return BindingBuilder.bind(queue).to(exchange).with("REDIS-KEY").noargs();
    }





}
